﻿

Public Class MyUTF8

    Public Shared Function GetUTF8String(Text As String) As String
        Try
            If String.IsNullOrWhiteSpace(Text) Then Return ""
            Text = Replace(Text, "---", "-") ' -- wird von mysql als bemerkung verwertet.. vielleicht ist \- möglich.. 
            Text = Replace(Text, "--", "-")
            Text = Replace(Text, "\", "\\'")
            Text = Replace(Text, "'", "\'")
            Text = Replace(Text, Chr(34), "\" & Chr(34))
            Text = Replace(Text, Chr(10), "\n")
            Text = Replace(Text, Chr(13), "\n")
        Catch ex As Exception
            Stop
        End Try
        Return Text
    End Function
    Public Shared Function Utf8ToIso(ByVal utf8String As String)
        utf8String = Replace(utf8String, "Ã§", "ç")
        utf8String = Replace(utf8String, "ä§", "ç")
        utf8String = Replace(utf8String, "Ã©", "é")
        utf8String = Replace(utf8String, "ä©", "é")
        utf8String = Replace(utf8String, "Ã¨", "è")
        utf8String = Replace(utf8String, "ä¨", "è")
        utf8String = Replace(utf8String, "Ãª", "ê")
        utf8String = Replace(utf8String, "äª", "ê")
        utf8String = Replace(utf8String, "Ã«", "ë")
        utf8String = Replace(utf8String, "ä«", "ë")
        utf8String = Replace(utf8String, "ÃŠ", "Ê")
        utf8String = Replace(utf8String, "äŠ", "Ê")
        utf8String = Replace(utf8String, "Ã‹", "Ë")
        utf8String = Replace(utf8String, "ä‹", "Ë")
        utf8String = Replace(utf8String, "Ã®", "î")
        utf8String = Replace(utf8String, "ä®", "î")
        utf8String = Replace(utf8String, "Ã¯", "ï")
        utf8String = Replace(utf8String, "ä¯", "ï")
        utf8String = Replace(utf8String, "Ã¬", "ì")
        utf8String = Replace(utf8String, "ÃŽ", "Î")
        utf8String = Replace(utf8String, "äŽ", "Î")
        utf8String = Replace(utf8String, "Ã²", "ò")
        utf8String = Replace(utf8String, "ä²", "ò")
        utf8String = Replace(utf8String, "Ã´", "ô")
        utf8String = Replace(utf8String, "ä´", "ô")
        utf8String = Replace(utf8String, "Ã¶", "ö")
        utf8String = Replace(utf8String, "ä¶", "ö")
        utf8String = Replace(utf8String, "Ãµ", "õ")
        utf8String = Replace(utf8String, "Ã³", "ó")
        utf8String = Replace(utf8String, "Ã¸", "ø")
        utf8String = Replace(utf8String, "äµ", "õ")
        utf8String = Replace(utf8String, "ä³", "ó")
        utf8String = Replace(utf8String, "ä¸", "ø")
        utf8String = Replace(utf8String, "Ã""", "Ô")
        utf8String = Replace(utf8String, "ä""", "Ô")
        utf8String = Replace(utf8String, "Ã–", "Ö")
        utf8String = Replace(utf8String, "ä–", "Ö")
        utf8String = Replace(utf8String, "Ã ", "à")
        utf8String = Replace(utf8String, "ä ", "à")
        utf8String = Replace(utf8String, "Ã¢", "â")
        utf8String = Replace(utf8String, "ä¢", "â")
        utf8String = Replace(utf8String, "Ã¤", "ä")
        utf8String = Replace(utf8String, "ä¤", "ä")
        utf8String = Replace(utf8String, "Ã¥", "å")
        utf8String = Replace(utf8String, "ä¥", "å")
        utf8String = Replace(utf8String, "Ã‚", "Â")
        utf8String = Replace(utf8String, "ä‚", "Â")
        utf8String = Replace(utf8String, "Ã„", "Ä")
        utf8String = Replace(utf8String, "ä„", "Ä")
        utf8String = Replace(utf8String, "Ã¹", "u")
        utf8String = Replace(utf8String, "Ã»", "û")
        utf8String = Replace(utf8String, "Ã¼", "ü")
        utf8String = Replace(utf8String, "ä¼", "ü")
        utf8String = Replace(utf8String, "Ã›", "Û")
        utf8String = Replace(utf8String, "Ãœ", "Ü")
        utf8String = Replace(utf8String, "ä¹", "u")
        utf8String = Replace(utf8String, "ä»", "û")
        utf8String = Replace(utf8String, "ä¼", "ü")
        utf8String = Replace(utf8String, "ä¼", "ü")
        utf8String = Replace(utf8String, "ä›", "Û")
        utf8String = Replace(utf8String, "äœ", "Ü")
        utf8String = Replace(utf8String, "Ã²", "ñ")
        utf8String = Replace(utf8String, "Ã±", "ñ")
        Return utf8String
    End Function
    Public Shared Function Single2UTF8(Value As Single) As String
        Dim s As String = Single.Parse(CStr(Value), Globalization.NumberStyles.AllowDecimalPoint + Globalization.NumberStyles.AllowLeadingSign)
        s = s.Replace(",", ".")
        Return s
    End Function

End Class
